package core

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
)

func GetConfig() []map[string]map[string]interface{} {
	appRoot := GetRunPath()
	var data []map[string]map[string]interface{}
	config, err := ioutil.ReadFile(appRoot + "/config.json")
	if err != nil {
		errMsg := fmt.Sprintf("error: %s,\n please run: cp %s/src/deployment/config.json %s/bin", err, appRoot, appRoot)
		panic(errMsg)
	}
	err = json.Unmarshal([]byte(config), &data)
	if err != nil {
		fmt.Println(err)
	}
	return data
}
